package com.minimoment.model.action;

import com.minimoment.base.BaseAction;
import com.minimoment.model.domain.Area;
import net.sf.json.JSONArray;
import net.sf.json.JsonConfig;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

/**
 * Created by etund on 2014/11/9.
 */
@Controller
@Scope("prototype")
public class AreaAction  extends BaseAction<Area> {
    private String str;
    private String result;
    private JSONArray resultTree;
        public String getTheArea() throws Exception{
            if(str!=null){
                JsonConfig jsonConfig = new JsonConfig();
                jsonConfig.setExcludes(new String[]{"schools","theaters","users"});
               areas = this.areaService.getTheAreas(str);
                resultTree = JSONArray.fromObject(areas,jsonConfig);
                result = resultTree.toString();
                return "area";
            }
             return "error";
        }

    public String getResult() {
        return result;
    }

    public void setResult(String result) {
        this.result = result;
    }

    public JSONArray getResultTree() {
        return resultTree;
    }

    public void setResultTree(JSONArray resultTree) {
        this.resultTree = resultTree;
    }

    public String getStr() {
        return str;
    }

    public void setStr(String str) {
        this.str = str;
    }
}
